package com.mentaleye.dal.dao.mybatis;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.mentaleye.dal.dao.StudentPunchRecordDao;
import com.mentaleye.dal.model.StudentPunchRecord;
import com.mentaleye.dal.model.StudentPunchRecordExample;
import com.mentaleye.dal.service.StudentPunchRecordMapper;

@Repository
public class StudentPunchRecordDaoImpl implements StudentPunchRecordDao {

	@Autowired
	private StudentPunchRecordMapper recordMapper;
	
	@Override
	public boolean insertByList(List<StudentPunchRecord> recordList) {
		boolean isSuccess=false;
		int result=this.recordMapper.insertByList(recordList);
		if(result>0)
		{
			isSuccess=true;
		}
		return isSuccess;
	}

	@Override
	public boolean updateRecord(StudentPunchRecord record) {
		boolean isSuccess=false;
		int result=this.recordMapper.updateByPrimaryKey(record);
		if(result>0)
		{
			isSuccess=true;
		}
		return isSuccess;
	}
	
	@Override
	public List<StudentPunchRecord> getListByExample(StudentPunchRecordExample example) {
		return this.recordMapper.selectByExample(example);
	}
	
	@Override
	public List<Map<String,Object>> getListByMap(Map<String, Object> map) {
		return this.recordMapper.getListByMap(map);
	}

	@Override
	public boolean deleteByExample(StudentPunchRecordExample example) {
		boolean isSuccess=false;
		int result=this.recordMapper.deleteByExample(example);;
		if(result>0)
		{
			isSuccess=true;
		}
		return isSuccess;
	}

	@Override
	public boolean deleteByWriteTime(Date writeTime) {
		boolean isSuccess=false;
		int result=this.recordMapper.deleteByWriteTime(writeTime);
		if(result>0)
		{
			isSuccess=true;
		}
		return isSuccess;
	}
}
